package lesson04;

import javax.swing.*;
import java.awt.*;

public class JPanelDemo extends JFrame {
    public JPanelDemo() {
        Container container = this.getContentPane();
         //后面的参数 是间距
        container.setLayout(new GridLayout(3,3,10,10));

        JPanel panel1=new JPanel(new GridLayout(1,3));
        JPanel panel2=new JPanel(new GridLayout(1,3));
        JPanel panel3=new JPanel(new GridLayout(1,3));

        panel1.add(new JButton("1"));
        panel1.add(new JButton("2"));
        panel1.add(new JButton("3"));
        panel2.add(new JButton("1"));
        panel2.add(new JButton("2"));
        panel2.add(new JButton("3"));
        panel3.add(new JButton("1"));
        panel3.add(new JButton("2"));
        panel3.add(new JButton("3"));
        container.add(panel1);
        container.add(panel2);
        container.add(panel3);
        setVisible(true);
        setBounds(200,200,500,500);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new JPanelDemo();
    }
}
